Skip to content

Improve poll dialogs TalkBack accessibility#6466

Open
andremion wants to merge 4 commits into
developfrom
fix/compose-poll-results-sheet-a11y
Open

Improve poll dialogs TalkBack accessibility#6466
andremion wants to merge 4 commits into
developfrom
fix/compose-poll-results-sheet-a11y

Conversation

@andremion
Copy link
Copy Markdown
Contributor

@andremion andremion commented May 22, 2026

AND-1180

Goal

The poll-results bottom sheet, the per-option votes screen, the comments dialog, and the more-options dialog were hard to navigate with TalkBack: the screen title wasn't announced on open, sub-section labels weren't navigable as headings, vote/comment rows produced one focus per child element (avatar, name, date), and the radio/checkbox in the more-options dialog was unlabeled. This PR fixes all of that so each row is a single focus with a meaningful announcement, and dialog titles identify their screen.

Implementation

  • PollDialogHeader (shared by all four poll dialogs): title Text carries heading() semantics, and the header sends a programmatic view.announceForAccessibility(title) on first composition. ModalBottomSheet swallows the standard paneTitle window-state-changed event, so programmatic announce is the reliable workaround.
  • PollVoteItem (shared by results + per-option votes screens): the row merges its descendants so each vote announces as one focus (avatar + name + date).
  • PollViewResultDialog: option header (Option N) + summary row (option text + winner badge + vote count) wrapped in a merged Column with heading() — one focus per option summary, navigable via TalkBack's heading shortcut. Question section also merged with heading().
  • PollOptionVotesDialog: the trophy-and-vote-count header row above the votes list is merged.
  • PollAnswers: each comment card merges the answer text with the user/timestamp row into one focus; the "Update Your Comment" button stays as its own separate focus.
  • PollMoreOptionsDialog: applies the same pattern as the just-merged inline poll (PollMessageContent, Improve poll vote row TalkBack accessibility #6461): each option row is toggleable with Role.RadioButton (single-vote polls) or Role.Checkbox (multi-vote), the RadioCheck is hidden from accessibility since the toggleable row already conveys state, the vote count gets a plural contentDescription, and the LinearProgressIndicator is removed from the semantics tree (the row already carries the count). Question section also merged with heading().

No visible UI changes; layout, colours, and behaviour are unchanged.

Testing

  1. Enable TalkBack.
  2. Long-press a poll message and open View Results:
    • Sheet open should announce the screen title ("Poll Results").
    • Swiping right should focus the back button, then the question section (one focus, announced as a heading), then each option summary ("Option 1, A, 3 votes" / "Option 1, A, Winner badge, 3 votes"), then each vote row as one focus, then the "Show all" button (when present), then the total votes count.
    • TalkBack's heading-navigation shortcut should jump between the question and each option.
  3. From the results screen, tap Show all on an option:
    • The per-option votes screen should announce its title (the option text).
    • The top header row should announce "Winner badge, 3 votes" as one focus (when the option is the winner).
    • Each vote announces as a single merged focus.
  4. Open View Comments on a poll with answers:
    • Title should be announced as "Poll Comments".
    • Each comment card should announce as one focus (comment text, user, timestamp). The "Update Your Comment" button (on the current user's own answer) is a separate focus.
  5. Open a poll with more options than the inline preview shows, tap Show all options:
    • Title should be announced.
    • Each option row should announce as one focus, including option text, vote count and toggle state ("not checked / checked, RadioButton" or "Checkbox"); double-tap toggles the vote.
    • The question section should announce as one focus and act as a heading.

Summary by CodeRabbit

  • Improvements
    • Enhanced accessibility support across poll components with improved screen reader compatibility.
    • Added semantic structure for better navigation and content description of poll titles and options.
    • Improved vote interaction feedback with clearer accessibility descriptions for vote counts.

Review Change Stack

@andremion andremion requested a review from a team as a code owner May 22, 2026 12:20
@andremion andremion added the pr:improvement Improvement label May 22, 2026
@andremion
Copy link
Copy Markdown
Contributor Author

@CodeRabbit review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 22, 2026

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled, or the PR is bot-authored.
  • An issue is linked (Linear ticket or GitHub issue), or the PR is bot-authored.

🎉 Great job! This PR is ready for review.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c83f6a45-1f66-4585-af86-3cae5af6a903

📥 Commits

Reviewing files that changed from the base of the PR and between 0b68a9e and c4ec0e5.

📒 Files selected for processing (6)
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/poll/PollAnswers.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/poll/PollDialogHeader.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/poll/PollMoreOptionsDialog.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/poll/PollOptionVotesDialog.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/poll/PollViewResultDialog.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/poll/PollVoteItem.kt

Walkthrough

This PR improves accessibility across six poll UI components in Stream Chat Android Compose by adding semantics imports, marking dialog titles as headings with announcements, grouping content with merged-descendants semantics, and enhancing vote interaction with dynamic toggle roles and pluralized semantic descriptions for screen readers.

Changes

Poll Accessibility Enhancements

Layer / File(s) Summary
Semantics imports and foundation
stream-chat-android-compose/.../poll/PollAnswers.kt, PollDialogHeader.kt, PollMoreOptionsDialog.kt, PollOptionVotesDialog.kt, PollViewResultDialog.kt, PollVoteItem.kt
Adds Compose semantics imports and utility imports (LaunchedEffect, LocalView, toggleable, applyIf) needed for accessibility updates across all poll UI files.
Dialog headers and title semantics
stream-chat-android-compose/.../poll/PollDialogHeader.kt, PollMoreOptionsDialog.kt, PollViewResultDialog.kt
Dialog titles are marked as semantic headings; PollDialogHeader announces title changes via accessibility API for TalkBack readers.
Content grouping with merged semantics
stream-chat-android-compose/.../poll/PollAnswers.kt, PollVoteItem.kt, PollViewResultDialog.kt, PollOptionVotesDialog.kt
Answer items, vote items, result items, and winner rows are wrapped in containers with mergeDescendants = true to group related content as single accessibility units.
Vote interaction and semantic descriptions
stream-chat-android-compose/.../poll/PollMoreOptionsDialog.kt
Vote options gain dynamic toggleRole (radio or checkbox based on maxVotesAllowed), vote handlers gated by poll state, pluralized vote-count descriptions exposed via contentDescription, and progress indicators explicitly cleared of semantics.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • gpunto

Poem

🐰 Polls now speak clear for those who listen,
Headings marked and votes glow 'round,
Merged semantics make the tree shimmer bright,
Radio buttons and checkboxes know their role,
Accessibility hops forward, bound!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: TalkBack accessibility improvements across poll dialogs, which is the primary focus of all modifications in the changeset.
Description check ✅ Passed The description includes Goal, Implementation with technical details, and comprehensive Testing instructions. However, it lacks UI Changes screenshots/videos section and Contributor/Reviewer Checklists from the template.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/compose-poll-results-sheet-a11y

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 22, 2026

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.82 MB 5.82 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.02 MB 11.02 MB 0.00 MB 🟢
stream-chat-android-compose 12.42 MB 12.42 MB 0.00 MB 🟢

@andremion andremion enabled auto-merge (squash) May 22, 2026 13:08
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
70.8% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:improvement Improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant